package com.yxqy.base_model.utils

import android.view.View
import androidx.annotation.IntDef
import com.ym521.freesnack.core.FreeSnackFactory
import com.ym521.freesnack.FreeSnackTime
import com.ym521.freesnack.theme.FreeSnackTheme

/**
 *@author: Ym
 *@version: 1.0.0
 *@createTime: 2023/9/4
 *@updateTime:
 *@describe: Snackbar 封装
 * Snackbar 替代 以前的Toast
 */
object FreeSnack {
    const val TOP = 1
    const val CENTER = 0
    const val BOTTOM = -1

    @IntDef(TOP, CENTER, BOTTOM)
    @Target(AnnotationTarget.VALUE_PARAMETER)
    @Retention(AnnotationRetention.SOURCE)
    annotation class FreeSnackGravity

    fun show(view: View, content: String, freeSnackTime: FreeSnackTime, @FreeSnackGravity gravity: Int,theme: FreeSnackTheme) {
        when (gravity) {
            TOP -> FreeSnackFactory.topShow(view, content, freeSnackTime.time,theme)
            CENTER -> FreeSnackFactory.centerShow(view, content, freeSnackTime.time,theme)
            BOTTOM -> FreeSnackFactory.bottomShow(view, content, freeSnackTime.time,theme)
        }
    }

}